<template>
    <div>
        <preview-temp :templateId="id" :title="title" :type="2" advancedType='10004' @back="back"/>
    </div>
</template>
<script>
export default {
    data() {
        return {
            title: '',
            id: '',
            currentPath: ''
        }
    },
    components: { 
        previewTemp: resolve => require(['../component/previewCom'], resolve),
    },
    created() {
        let {id, title, currentPath} = this.$route.params;
        this.id = id;
        this.title = title;
        this.currentPath = currentPath;
        this.path = this.$route.path;
        if (id == undefined) {
            this.back();
        }
    },
    methods: {
        back() {
            this.$router.push({
                path: this.currentPath
            })
        }
    },
    destroyed() {
        this.$store.commit('delete_tabs', this.path);
    },
}
</script>
